package com.iims.product.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.iims.common.core.domain.BaseEntity;
import com.iims.common.core.domain.BussinessEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Positive;
import javax.validation.constraints.Size;
import java.math.BigDecimal;

/**
 * @TableName cmis_product
 */
@ApiModel("产品")
@Data
@TableName(value = "cmis_product")
@BussinessEntity
public class Product extends BaseEntity {

    @ApiModelProperty(value = "主键,修改时必传", position = -1)
    @TableId(type = IdType.AUTO)
    private Long productId;

    /**
     * 产品类型Id
     */
    @ApiModelProperty(value = "产品类型Id", required = true)
    @Positive(message = "产品类型Id必须有效 >0")
    private Integer prodTypeId;

    /**
     * 产品名称
     */
    @ApiModelProperty(value = "产品名称")
    @NotBlank(message = "产品名称不能为空")
    @Size(min = 0, max = 255, message = "产品名称长度不超过255字符")
    private String productName;

    /**
     * 产品型号
     */
    @ApiModelProperty(value = "产品型号")
    @NotBlank(message = "产品型号不能为空")
    @Size(max = 100, message = "产品型号长度不超过100字符")
    private String productModel;

    /**
     * 频率范围
     */
    @ApiModelProperty(value = "频率范围:不超过50字符")
    @NotBlank(message = "产品频率范围不能为空")
    @Size(max = 50, message = "频率范围长度不超过50字符")
    private String productBand;

    /**
     * 单价
     */
    @ApiModelProperty(value = "单价/元")
    private BigDecimal price;

    /**
     * 单位
     */
    @ApiModelProperty(value = "单位")
    @Size(min = 0, max = 100, message = "单位长度不超过100字符")
    private String units;

    /**
     * 产品负责人
     */
    @ApiModelProperty(value = "产品负责人(user_code)")
    private String producCharge;

    /**
     * 图片地址
     */
    @ApiModelProperty(value = "图片地址")
    private String piturePath;

    /**
     * 产品描述
     */
    @ApiModelProperty(value = "产品描述")
    @Size(min = 0, max = 255, message = "产品名称长度不超过255字符")
    private String productDescr;

    //vo
    @ApiModelProperty("产品类型名称")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField(exist = false)
    private String prodTypeName;

    @ApiModelProperty(value = "负责人(中文)", hidden = true)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField(exist = false)
    private String chargeMan;

}